<template>
  <view class="page-box">
    <view class="money-input-box">
      <text class="money-title-box">提现金额</text>
      <text class="money-symbol-box">¥</text>
      <input class="money-value-box" v-model="bankCardInfo.money" disabled placeholder="输入金额" />
    </view>
    <view class="step-btn-box" @click="saveClick">
      确定
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      bankCardInfo: {
        bankName: '',
        cardNumber: '',
        money: ''
      }
    }
  },
  onShow() {
    let self = this
    self.getMoney()
  },
  methods: {
    getMoney(){
      this.$http.post('api/bonus/withdraw_money').then((res) => {
        console.log("=======res",res)
        this.bankCardInfo.money = res.data
      }).catch((err) => {
      })
    },
    saveClick() {
      this.$http.post('api/bonus/withdraw').then((res) => {
        uni.showToast({
          title: res.msg || '提现成功',
          icon: 'success',
          duration:2000
        })
        setTimeout(()=>{
          console.log('aaa')
          uni.redirectTo({
            url: '/pages/home/home'
          });
        },2000)
      }).catch((err) => {
        uni.showToast({
          title: err.data.msg || '提现失败',
          icon: 'none'
        })
      })
    }
  }
}
</script>

<style>
.page-box {
  width: 100%;
  height: 100%;
}

.select-bank-card {
  height: 54px;
  margin-left: 16px;
  width: calc(100% - 32px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #E5E5E5;
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #010101;
}

.allow-icon {
  width: 7px;
  height: 13px;
  background: url(../../static/allow-icon.png);
  background-size: 100% 100%;
}

.money-input-box {
  height: 54px;
  margin-left: 16px;
  width: calc(100% - 32px);
  display: flex;
  align-items: center;
  border-bottom: 1px solid #E5E5E5;
}

.money-title-box {
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #010101;
  margin-right: 16px;
}

.money-symbol-box {
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #010101;
}

.money-value-box {
  margin-left: 8px;
  width: calc(100% - 120px);
}

.step-btn-box {
  position: absolute;
  left: 16px;
  bottom: 24px;
  height: 46px;
  width: calc(100% - 32px);
  line-height: 46px;
  text-align: center;
  background: #010101;
  border-radius: 23px;
  font-size: 18px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #FFFFFF;
}
</style>
